$(document).ready(function(){

});

function addFruits(){
    var name = $("input[name='name']").val();
    var subRegion = $("input[name='subRegion']").val();

    $.ajax({
        url: "/fruits/addFruits",
        type: 'GET',
        data: {
            'name': name,
            'subRegion': subRegion
        },
        dataType: "JSON",
        async: false,
        success: function (res) {
            if(res.code === "200") {
                window.location.href = "/fruitslist";
            }else {
                alert(res.msg)
            }
        },
        error: function (e){
            alert('发生错误')
        }

    })
}